import BaseMusicPrefab from "../../base/Script/components/BaseMusicPrefab";
import BundleManager from "../../base/Script/core/BundleManager";
import SceneNavigator from "../../base/Script/core/SceneNavigator";

const { ccclass, property } = cc._decorator;

@ccclass
export default class start extends cc.Component {


    @property(cc.Component.EventHandler)
    handle: cc.Component.EventHandler = null

    // LIFE-CYCLE CALLBACKS:

    onLoad() {
        this.node.on('apart', this.apart, this);
    }

    start() {

    }

    // update (dt) {}

    apart() {
        //启用事件
        this.handle.emit([]);
    }

    startGame(){
        BaseMusicPrefab.destory();
        this.scheduleOnce(()=>{
            cc.director.loadScene('game_fn');
        },1);
    }

    overGame(){
        BaseMusicPrefab.destory();
        this.scheduleOnce(()=>{
            // cc.game.end();
            BundleManager.ins().releaseAll('FruitNinja');
            SceneNavigator.goHome({});
        },1);
    }

    onDestroy() {
        
    }
}
